package dao.index.impl;

import javax.sql.DataSource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import po.UserIndex;

import com.ibatis.sqlmap.client.SqlMapClient;

import dao.index.UserIndexDAO;

public class UserIndexDAOImpl extends SqlMapClientDaoSupport implements UserIndexDAO {
	
	@Autowired
	public UserIndexDAOImpl(SqlMapClient sqlMapClient, DataSource dataSource) {
		this.setSqlMapClient(sqlMapClient);
		this.setDataSource(dataSource);
	}
	
	@Override
	public UserIndex getUserIndex(String loginname) {
		return (UserIndex)this.getSqlMapClientTemplate().queryForObject("getUserIndex", loginname);
	}

	@Override
	public void insertUserIndex(UserIndex userIndex) {
		this.getSqlMapClientTemplate().insert("insertUserIndex",userIndex);
	}

}
